<template>
<div>
<wv-group title="地址">
  <wv-input label="发货人" placeholder="请输入发货人地址" :value="sendAddress" v-model="sendAddress"></wv-input>
  <wv-input label="收货人" placeholder="请输入收货人地址" :value="getAddress" v-model="getAddress"></wv-input><!-- type="number" -->
</wv-group>
</div>
</template>

<script>
import { Input } from 'we-vue'
import axios from 'axios'
export default {
  name: 'Order',
  data () {
    return {
      sendAddress: this.$store.state.sendAddress,
      getAddress: this.$store.state.getAddress
    }
  },
  watch: {
    sendAddress (val, oldval) {
      console.log(val)
      this.$store.commit('changeSendAddress', val)
    },
    getAddress (val, oldval) {
      console.log(val)
      this.$store.commit('changeGetAddress', val)
    }
  },
  components: {
    Input
  },
  methods: {
    getAddressIp () {
      axios.get('http://114.115.216.44:8080/easy/es/order/location?ip=117.181.50.73').then(this.getAddressIpSuccess)
    },
    getAddressIpSuccess (res) {
      console.log(res)
    }
  },
  mounted () {
    this.getAddressIp()
  }
}
</script>
